package window;

import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.io.IOException;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class About extends JPanel{
	  private ClassLoader cl = getClass().getClassLoader();
	  public ImageIcon logo = new ImageIcon(this.cl.getResource("icons/logo.gif"));
	  public ImageIcon ball = new ImageIcon(this.cl.getResource("icons/ball.gif"));
	  private JPanel centerPanel;
	  private JPanel topPanel;
	  private JLabel productName = new JLabel("<html><font face=\"verdana\" size=10>SocketTest", this.logo, 0);
	  private JTextArea readme = new JTextArea();
	  private JScrollPane jsp;
	  String html = "<html><font face=\"verdana\" size=\"2\">";
	  private JLabel versionText = new JLabel(this.html + "Version", this.ball, 2);
	  private JLabel version = new JLabel(this.html + ": 3.0.0", 2);
	  private JLabel licenceText = new JLabel(this.html + "Licence", this.ball, 2);
	  private JLabel licence = new JLabel(this.html + ": GNU Lesser General Public License", 2);
	  private JLabel authorText = new JLabel(this.html + "Author", this.ball, 2);
	  private JLabel author = new JLabel(this.html + ": Akshathkumar Shetty", 2);
	  private JLabel copyrightText = new JLabel(this.html + "Copyright &copy; 2003-2008 Akshathkumar Shetty", this.ball, 2);
	  private JLabel websiteText = new JLabel(this.html + "Website", this.ball, 2);
	  private JLabel website = new JLabel(this.html + ": http://sockettest.sourceforge.net/", 2);
	  private JLabel readmeText = new JLabel(this.html + "ReadMe", this.ball, 2);
	  private GridBagConstraints gbc = new GridBagConstraints();

	  public About()
	  {
	    About localAbout = this;
	    this.topPanel = new JPanel();
	    this.topPanel.setLayout(new GridBagLayout());
	    this.gbc.insets = new Insets(2, 2, 2, 2);
	    this.gbc.weighty = 0.0D;
	    this.gbc.weightx = 0.0D;
	    this.gbc.gridx = 0;
	    this.gbc.gridy = 0;
	    this.gbc.gridheight = 1;
	    this.gbc.gridwidth = 3;
	    this.gbc.anchor = 10;
	    this.gbc.fill = 0;
	    this.topPanel.add(this.productName, this.gbc);
	    this.gbc.anchor = 17;
	    this.gbc.fill = 2;
	    this.gbc.gridy = 1;
	    this.gbc.gridx = 0;
	    this.gbc.weightx = 0.0D;
	    this.topPanel.add(this.versionText, this.gbc);
	    this.gbc.gridx = 1;
	    this.topPanel.add(this.version, this.gbc);
	    this.gbc.gridx = 2;
	    this.gbc.weightx = 1.0D;
	    this.gbc.fill = 2;
	    this.topPanel.add(Box.createHorizontalGlue(), this.gbc);
	    this.gbc.gridy = 2;
	    this.gbc.gridx = 0;
	    this.gbc.weightx = 0.0D;
	    this.topPanel.add(this.licenceText, this.gbc);
	    this.gbc.gridx = 1;
	    this.topPanel.add(this.licence, this.gbc);
	    this.gbc.gridx = 2;
	    this.gbc.weightx = 1.0D;
	    this.gbc.fill = 2;
	    this.topPanel.add(new JLabel(), this.gbc);
	    this.gbc.gridy = 3;
	    this.gbc.gridx = 0;
	    this.gbc.weightx = 0.0D;
	    this.topPanel.add(this.authorText, this.gbc);
	    this.gbc.gridx = 1;
	    this.topPanel.add(this.author, this.gbc);
	    this.gbc.gridx = 2;
	    this.gbc.weightx = 1.0D;
	    this.gbc.fill = 2;
	    this.topPanel.add(Box.createHorizontalGlue(), this.gbc);
	    this.gbc.gridy = 4;
	    this.gbc.gridx = 0;
	    this.gbc.weightx = 0.0D;
	    this.topPanel.add(this.websiteText, this.gbc);
	    this.gbc.gridx = 1;
	    this.topPanel.add(this.website, this.gbc);
	    this.gbc.gridx = 2;
	    this.gbc.weightx = 1.0D;
	    this.gbc.fill = 2;
	    this.topPanel.add(Box.createHorizontalGlue(), this.gbc);
	    this.gbc.gridy = 5;
	    this.gbc.gridx = 0;
	    this.gbc.weightx = 0.0D;
	    this.gbc.gridwidth = 2;
	    this.topPanel.add(this.copyrightText, this.gbc);
	    this.gbc.gridwidth = 1;
	    this.gbc.gridx = 2;
	    this.gbc.weightx = 1.0D;
	    this.gbc.fill = 2;
	    this.topPanel.add(Box.createHorizontalGlue(), this.gbc);
	    this.gbc.gridy = 6;
	    this.gbc.gridx = 0;
	    this.gbc.weightx = 0.0D;
	    this.gbc.gridwidth = 1;
	    this.topPanel.add(this.readmeText, this.gbc);
	    this.gbc.gridx = 1;
	    this.topPanel.add(new JLabel(" "), this.gbc);
	    this.gbc.gridx = 2;
	    this.gbc.weightx = 1.0D;
	    this.gbc.fill = 2;
	    this.topPanel.add(Box.createHorizontalGlue(), this.gbc);
	    this.centerPanel = new JPanel();
	    this.readme.setText("Loading... readme");
	    try
	    {
	      String str = "测试";
	      this.readme.setText(str);
	    }
	    catch (Exception localIOException)
	    {
	      System.err.println("Error reading readme.txt " + localIOException);
	      this.readme.append("\r\nFailed : " + localIOException.getMessage());
	    }
	    this.readme.setEditable(false);
	    this.readme.setLineWrap(true);
	    this.readme.setWrapStyleWord(true);
	    this.jsp = new JScrollPane(this.readme);
	    this.centerPanel.setLayout(new BorderLayout());
	    this.centerPanel.add(this.jsp);
	    this.centerPanel.setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 9));
	    localAbout.setLayout(new BorderLayout(0, 10));
	    localAbout.add(this.topPanel, "North");
	    localAbout.add(this.centerPanel, "Center");
	    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
	  }
}
